﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace YiDingCanWp7
{
    public class LatestShopsSettings
    {
        public static LatestShopsSettings Instance = new LatestShopsSettings();

        List<ShopDTO> shops;
        public LatestShopsSettings() {
            
        }
        private Setting<List<ShopDTO>> latestShops = new Setting<List<ShopDTO>>("latestShops", null);
        public List<ShopDTO> LatestShops
        {
            get {
                return latestShops.Value;
            }
            set {
                latestShops.Value = value;
            }
        }
        public static void Add(ShopDTO shop)
        {
            List<ShopDTO> shops = Instance.LatestShops;
            if (shops == null)
            {
                shops = new List<ShopDTO>();
            }
            if (!shops.Contains(shop))
                shops.Add(shop);
           Instance.LatestShops = shops;
        }
        public static void Remove(ShopDTO shop)
        {
            List<ShopDTO> shops = Instance.LatestShops;
            if (shops == null)
            {
                shops = new List<ShopDTO>();
            }
            shops.Remove(shop);
            Instance.LatestShops = shops;
        }
    }
}
